<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.15"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>Library Evolutionary Algorithms for Clustering (LEAC): include/dist_template.hpp Source File</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td id="projectlogo"><img alt="Logo" src="leac_logo.png"/></td>
  <td id="projectalign" style="padding-left: 0.5em;">
   <div id="projectname">Library Evolutionary Algorithms for Clustering (LEAC)
   &#160;<span id="projectnumber">Version 1.0</span>
   </div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.15 -->
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
$(function() {
  initMenu('',false,false,'search.php','Search');
});
/* @license-end */</script>
<div id="main-nav"></div>
<div id="nav-path" class="navpath">
  <ul>
<li class="navelem"><a class="el" href="dir_d44c64559bbebec7f509842c48db8b23.html">include</a></li>  </ul>
</div>
</div><!-- top -->
<div class="header">
  <div class="headertitle">
<div class="title">dist_template.hpp</div>  </div>
</div><!--header-->
<div class="contents">
<a href="dist__template_8hpp.html">Go to the documentation of this file.</a><div class="fragment"><div class="line"><a name="l00001"></a><span class="lineno">    1</span>&#160;</div><div class="line"><a name="l00011"></a><span class="lineno">   11</span>&#160;<span class="preprocessor">#ifndef DIST_TEMPLATE_HPP</span></div><div class="line"><a name="l00012"></a><span class="lineno">   12</span>&#160;<span class="preprocessor">#define DIST_TEMPLATE_HPP</span></div><div class="line"><a name="l00013"></a><span class="lineno">   13</span>&#160;</div><div class="line"><a name="l00023"></a><span class="lineno">   23</span>&#160;<span class="keyword">namespace  </span><a class="code" href="namespacedist.html">dist</a> {</div><div class="line"><a name="l00024"></a><span class="lineno">   24</span>&#160;</div><div class="line"><a name="l00025"></a><span class="lineno">   25</span>&#160;</div><div class="line"><a name="l00033"></a><span class="lineno">   33</span>&#160;<span class="keyword">template</span> &lt; <span class="keyword">typename</span> T_FEATURE&gt;</div><div class="line"><a name="l00034"></a><span class="lineno">   34</span>&#160;T_FEATURE</div><div class="line"><a name="l00035"></a><span class="lineno">   35</span>&#160;<a class="code" href="namespacedist.html#a32fc945efb8cbd2bd1d65eac5cd3668c">kernelEuclidean</a></div><div class="line"><a name="l00036"></a><span class="lineno"><a class="line" href="namespacedist.html#aea9ed315f9c05442e8e688fa89934a7a">   36</a></span>&#160;(<span class="keyword">const</span> T_FEATURE* aiad_p, <span class="keyword">const</span> T_FEATURE* aiad_q, <span class="keyword">const</span> <a class="code" href="common_8hpp.html#a3f6c33fb604556cdc425e7aa2289d009">uintidx</a> aiuintidx_length)</div><div class="line"><a name="l00037"></a><span class="lineno">   37</span>&#160;{</div><div class="line"><a name="l00038"></a><span class="lineno">   38</span>&#160;  T_FEATURE lt_sumDiff = T_FEATURE(0);</div><div class="line"><a name="l00039"></a><span class="lineno">   39</span>&#160;  T_FEATURE lt_diff = T_FEATURE(0);</div><div class="line"><a name="l00040"></a><span class="lineno">   40</span>&#160;  </div><div class="line"><a name="l00041"></a><span class="lineno">   41</span>&#160;  <span class="keywordflow">for</span> ( <a class="code" href="common_8hpp.html#a3f6c33fb604556cdc425e7aa2289d009">uintidx</a> lui_i = 0; lui_i &lt; aiuintidx_length; lui_i++ ) {</div><div class="line"><a name="l00042"></a><span class="lineno">   42</span>&#160;    lt_diff  = aiad_p[lui_i] - aiad_q[lui_i];</div><div class="line"><a name="l00043"></a><span class="lineno">   43</span>&#160;    lt_sumDiff += lt_diff*lt_diff;</div><div class="line"><a name="l00044"></a><span class="lineno">   44</span>&#160;  }</div><div class="line"><a name="l00045"></a><span class="lineno">   45</span>&#160;  </div><div class="line"><a name="l00046"></a><span class="lineno">   46</span>&#160;  <span class="keywordflow">return</span>   std::sqrt(lt_sumDiff);  </div><div class="line"><a name="l00047"></a><span class="lineno">   47</span>&#160;}</div><div class="line"><a name="l00048"></a><span class="lineno">   48</span>&#160;</div><div class="line"><a name="l00049"></a><span class="lineno">   49</span>&#160;</div><div class="line"><a name="l00057"></a><span class="lineno">   57</span>&#160;<span class="keyword">template</span> &lt; <span class="keyword">typename</span> T_FEATURE&gt;</div><div class="line"><a name="l00058"></a><span class="lineno">   58</span>&#160;T_FEATURE</div><div class="line"><a name="l00059"></a><span class="lineno">   59</span>&#160;<a class="code" href="namespacedist.html#a7fc2d2b171f5568e3296e28e724ff142">kernelEuclideanSquared</a></div><div class="line"><a name="l00060"></a><span class="lineno"><a class="line" href="namespacedist.html#adadae13517e164fd9b69c28bf6fd7160">   60</a></span>&#160;(<span class="keyword">const</span> T_FEATURE* aiad_p, <span class="keyword">const</span> T_FEATURE* aiad_q, <span class="keyword">const</span> <a class="code" href="common_8hpp.html#a3f6c33fb604556cdc425e7aa2289d009">uintidx</a> aiuintidx_length)</div><div class="line"><a name="l00061"></a><span class="lineno">   61</span>&#160;{</div><div class="line"><a name="l00062"></a><span class="lineno">   62</span>&#160;  T_FEATURE lt_sumDiff = T_FEATURE(0);</div><div class="line"><a name="l00063"></a><span class="lineno">   63</span>&#160;  T_FEATURE lt_diff = T_FEATURE(0);</div><div class="line"><a name="l00064"></a><span class="lineno">   64</span>&#160;  </div><div class="line"><a name="l00065"></a><span class="lineno">   65</span>&#160;  <span class="keywordflow">for</span> ( <a class="code" href="common_8hpp.html#a3f6c33fb604556cdc425e7aa2289d009">uintidx</a> lui_i = 0; lui_i &lt; aiuintidx_length; lui_i++ ) {</div><div class="line"><a name="l00066"></a><span class="lineno">   66</span>&#160;    lt_diff  = aiad_p[lui_i] - aiad_q[lui_i];</div><div class="line"><a name="l00067"></a><span class="lineno">   67</span>&#160;    lt_sumDiff += lt_diff*lt_diff;</div><div class="line"><a name="l00068"></a><span class="lineno">   68</span>&#160;  }</div><div class="line"><a name="l00069"></a><span class="lineno">   69</span>&#160;  </div><div class="line"><a name="l00070"></a><span class="lineno">   70</span>&#160;  <span class="keywordflow">return</span>  lt_sumDiff;</div><div class="line"><a name="l00071"></a><span class="lineno">   71</span>&#160;</div><div class="line"><a name="l00072"></a><span class="lineno">   72</span>&#160;  <span class="comment">//return  std::inner_product(aiad_p,aiad_p+aiuintidx_length,aiad_q, 0);</span></div><div class="line"><a name="l00073"></a><span class="lineno">   73</span>&#160;   </div><div class="line"><a name="l00074"></a><span class="lineno">   74</span>&#160;}</div><div class="line"><a name="l00075"></a><span class="lineno">   75</span>&#160;</div><div class="line"><a name="l00076"></a><span class="lineno">   76</span>&#160;} <span class="comment">/*END namespace dist </span></div><div class="line"><a name="l00077"></a><span class="lineno">   77</span>&#160;<span class="comment">   */</span></div><div class="line"><a name="l00078"></a><span class="lineno">   78</span>&#160;</div><div class="line"><a name="l00079"></a><span class="lineno">   79</span>&#160;<span class="preprocessor">#endif </span><span class="comment">/*DIST_TEMPLATE_HPP*/</span><span class="preprocessor"></span></div><div class="line"><a name="l00080"></a><span class="lineno">   80</span>&#160;</div><div class="ttc" id="namespacedist_html"><div class="ttname"><a href="namespacedist.html">dist</a></div><div class="ttdoc">Module for definition of distance between objects or instances.</div></div>
<div class="ttc" id="common_8hpp_html_a3f6c33fb604556cdc425e7aa2289d009"><div class="ttname"><a href="common_8hpp.html#a3f6c33fb604556cdc425e7aa2289d009">uintidx</a></div><div class="ttdeci">uint32_t uintidx</div><div class="ttdef"><b>Definition:</b> <a href="common_8hpp_source.html#l00020">common.hpp:20</a></div></div>
<div class="ttc" id="namespacedist_html_a7fc2d2b171f5568e3296e28e724ff142"><div class="ttname"><a href="namespacedist.html#a7fc2d2b171f5568e3296e28e724ff142">dist::kernelEuclideanSquared</a></div><div class="ttdeci">double kernelEuclideanSquared(const double *aiarrayd_p, const double *aiarrayd_q, const uintidx uintidx_length)</div><div class="ttdoc">Gets the square Euclidean distance of two double n-dimensional points with SSE.</div><div class="ttdef"><b>Definition:</b> <a href="dist__kernel__64bits_8hpp_source.html#l00068">dist_kernel_64bits.hpp:68</a></div></div>
<div class="ttc" id="namespacedist_html_a32fc945efb8cbd2bd1d65eac5cd3668c"><div class="ttname"><a href="namespacedist.html#a32fc945efb8cbd2bd1d65eac5cd3668c">dist::kernelEuclidean</a></div><div class="ttdeci">double kernelEuclidean(const double *aiarrayd_p, const double *aiarrayd_q, const uintidx uintidx_length)</div><div class="ttdoc">Gets the Euclidean distance of two double n-dimensional points with SSE.</div><div class="ttdef"><b>Definition:</b> <a href="dist__kernel__64bits_8hpp_source.html#l00043">dist_kernel_64bits.hpp:43</a></div></div>
</div><!-- fragment --></div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated on Fri Apr 19 2019 08:58:31 for Library Evolutionary Algorithms for Clustering (LEAC) by &#160;<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.15
</small></address>
</body>
</html>
